inoremap <buffer> [ []<Left>
inoremap <buffer> ( ()<Left>
inoremap <buffer> { {}<Left>

inoremap <buffer><expr> <Bar> GCAutoQuotes("\<Bar>")
inoremap <buffer><expr> " GCAutoQuotes("\"")
inoremap <buffer><expr> ' GCAutoQuotes("'")

function! GCCurrent()
	return getline('.')[col('.')-1]
endf

function! GCAutoClose(open, close)
	if GCCurrent() == a:close
	  return "\<Right>"
	else
	  return a:open .  a:close . "\<Left>"
	endif 
endf

function! GCAutoQuotes(quote)
	if GCCurrent() == a:quote
		return "\<Right>"
	else
	 	return a:quote . a:quote . "\<Left>"
	endif
endfunction
